package top.pmwly;

/**
 * @author Herther
 * @version 1.0.0
 * @ClassName Test1.java
 * @Description 测试1
 * @createTime 2021年08月16日 15:19:00
 */
public class Test1 {
    public static void main(String[] args) {
        //性能测试
        int[] sizes = {10000,100000};
        for (int n:sizes){
            Integer[] arr = ArrayGenerate.randomGenerate(n, n);
            long startTime = System.nanoTime();
            InsertionSort.sort(arr);
            long endTime = System.nanoTime();
            Double time = (endTime - startTime) / 1000000000.0;
            //测试是否正确
            boolean sorted = SortHelper.sortTest(arr);
            if (!sorted){
                throw new RuntimeException("排序有误");
            }
            System.out.println("测试"+n+"个数的排序的时间为"+time +"s");
        }
    }
}
